﻿using System.Web.Mvc;

namespace MyAMS.WebServer.Results
{
    /// <summary>
    /// 不存在的视图结果
    /// </summary>
    public class NotFoundResult : ViewResult
    {
        /// <summary>
        /// 当被动作触发器调用时，将试图呈现到回复上下文中
        /// </summary>
        /// <param name="context">结果被执行的控制器上下文</param>
        public override void ExecuteResult(ControllerContext context)
        {
            ViewData = context.Controller.ViewData;
            TempData = context.Controller.TempData;
            ViewName = "NotFound";

            base.ExecuteResult(context);

            context.HttpContext.Response.StatusDescription = "File Not Found";
            context.HttpContext.Response.StatusCode = 404;
        }
    }
}
